package com.ato.mybatis.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author wangjing
 * @create 2021--09--27--下午 2:50
 */
@Configuration(proxyBeanMethods = false)
public class CorsConfig implements WebMvcConfigurer {
    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {

            @Override
            public void addCorsMappings(CorsRegistry registry) {
                registry.addMapping("/**");
                registry.addMapping("/api/**");
////                添加Knife4j：swagger
//                想了下，这里跨域的问题，swagger的就是在和localhost://8899/api 下 ，怎么会跨域，，，，SB了。
//                registry.addMapping("/api/doc.html");
//                registry.addMapping("/v2/api-docs");
//                registry.addMapping("/v2/api-docs-ext");
//                registry.addMapping("/swagger-resources/");
//                registry.addMapping("/swagger-resources/**");

            }

        };
    }

}
